package com.kjlink.widget.login;

import cn.xuqiudong.common.util.JsonUtil;
import cn.xuqiudong.common.util.encrypt.RsaUtils;

/**
 * 描述:
 *
 * @author Vic.xu
 * @since 2025-09-01 16:50
 */
public class AutoLoginTest {

    public static String public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCGhTvuSNZypoc4Vi7Lty801cSM7AFpWk6sRn0uUgCIyW3CNYvj5VDAm9g2Vfcuv0-4eHW9yW_Vm968FdiILeQ9p1_7fpLNx0BxRzL71t4GIf4YGoQX2exEYZN6hvtQQAxhZyaRmyT-ZQk3L2sV5IjhAiTaNtYFyWGdTE2p4OD1mwIDAQAB";

    public static String private_key = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIaFO-5I1nKmhzhWLsu3LzTVxIzsAWlaTqxGfS5SAIjJbcI1i-PlUMCb2DZV9y6_T7h4db3Jb9Wb3rwV2Igt5D2nX_t-ks3HQHFHMvvW3gYh_hgahBfZ7ERhk3qG-1BADGFnJpGbJP5lCTcvaxXkiOECJNo21gXJYZ1MTang4PWbAgMBAAECgYA1pgM9yAzGksWQ4UYudrM79hk6PpFdi-eea0pXY9rUssi0UJim3fizqDO1j9lR6niH0Hrcou6YGV7eUjQWM383wCu11CNzOZZ0cbxavqzhoycxQGDfdKe84pR18Q-ubEy_Rxg1lUoqqs6_8dsSGD1oi9Mub3GDC8iXgB07ad834QJBAP25w-xDkOXNXM5yZ5LXvIoL4WZcpPsRMrK8OEH1o61-snEA0ZHjPoxNQe-VHrI9FDE1N2LjPTWfvAJdCjzKvrECQQCHuex365gn2JcehuJ0jOaPgUJQgNDVjw7g7UCW8opmRUlLsrJgr3VhAuwB1hBlEOrYDLGkFTxlD309jW3YMAQLAkAjDG85CthQNj8UsY8HJNABjcSUHEYZ_HUxZXir-9-hTrgdjgxlB6wTO3TZQJMd8fwBFCXTfiptZuRUuz93yFXxAkBRcqEU1axZPQBysT7z8hnpxAenh6XKgi7Li5RXAPVMqgdyBapFmwU1UiuObocoHx7Ox89SR-wWOVVOurBQK4BBAkEA_bMbfYmftpCi4FboEDFVotfC5iDvYWE1cbXD3jW0I9Ufa7ZWaXckYRnLGdLBabrIaptvRTwuHhtwq_67b00umA";


    public static void main(String[] args) {
        // {"username":"zhangsan","appId":"0123456","timestamp":1756436079883}
        TokenSignModel model = new TokenSignModel( "zhangsan", "0123456");
        model.setTimestamp(1756436079883L);
        String json = JsonUtil.toJson(model);
        System.out.println("原始json串:" + json);
        String s = RsaUtils.privateEncrypt(json, private_key);
        System.out.println("私钥加密后:");
        System.out.println(s);
        System.out.println("公钥解密后:");
        System.out.println(RsaUtils.publicDecrypt(s, public_key));


        long timestamp = 1756715393080L;
        TokenSignModel model2 = new TokenSignModel( "01000556", "kjlink-aircraft");
        model.setTimestamp(timestamp);
        String json2 = JsonUtil.toJson(model2);
        System.out.println("原始json串:" + json2);
        String s2 = RsaUtils.privateEncrypt(json2, private_key);
        System.out.println("私钥加密后:");
        System.out.println(s2);
        System.out.println("公钥解密后:");
        System.out.println(RsaUtils.publicDecrypt(s2, public_key));
    }
}
